home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Dev / gcc263-src.lha / gcc-2.6.3 / config / i386 / sun386.h < prev    next >
C/C++ Source or Header  |  1993-09-27  |  5KB  |  143 lines

  1. /* Definitions for Sun assembler syntax for the Intel 80386.
  2.    Copyright (C) 1988 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  6. GNU CC is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU CC is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU CC; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20.  
  21. /* Include common aspects of all 386 Unix assemblers.  */
  22. #include "i386/unix.h"
  23.  
  24. #define TARGET_VERSION fprintf (stderr, " (80386, Sun syntax)");
  25.  
  26. /* Define the syntax of instructions and addresses.  */
  27.  
  28. /* Prefix for internally generated assembler labels.  */
  29. #define LPREFIX ".L"
  30.  
  31. /* Define the syntax of pseudo-ops, labels and comments.  */
  32.  
  33. /* Assembler pseudos to introduce constants of various size.  */
  34.  
  35. #define ASM_BYTE_OP "\t.byte"
  36. #define ASM_SHORT "\t.value"
  37. #define ASM_LONG "\t.long"
  38. #define ASM_DOUBLE "\t.double"
  39.  
  40. /* How to output an ASCII string constant.  */
  41.  
  42. #define ASM_OUTPUT_ASCII(FILE, p, size) \
  43. do                                \
  44. { int i = 0;                             \
  45.   while (i < (size))                        \
  46.     { if (i%10 == 0) { if (i!=0) fprintf ((FILE), "\n");    \
  47.                fprintf ((FILE), "%s ", ASM_BYTE_OP); }    \
  48.       else fprintf ((FILE), ",");                \
  49.       fprintf ((FILE), "0x%x", ((p)[i++] & 0377)) ;}        \
  50.       fprintf ((FILE), "\n");                    \
  51. } while (0)
  52.  
  53. /* Output at beginning of assembler file.  */
  54. /* The .file command should always begin the output.  */
  55.  
  56. #undef ASM_FILE_START
  57. #define ASM_FILE_START(FILE) \
  58.   do {                            \
  59.     extern char *version_string, *language_string;    \
  60.     {                            \
  61.       int len = strlen (dump_base_name);        \
  62.       char *na = dump_base_name + len;            \
  63.       char shorter[15];                    \
  64.       /* NA gets DUMP_BASE_NAME sans directory names.  */\
  65.       while (na > dump_base_name)            \
  66.     {                        \
  67.       if (na[-1] == '/')                \
  68.         break;                    \
  69.       na--;                        \
  70.     }                        \
  71.       strncpy (shorter, na, 14);            \
  72.       shorter[14] = 0;                    \
  73.       fprintf (FILE, "\t.file\t");            \
  74.       output_quoted_string (FILE, shorter);        \
  75.       fprintf (FILE, "\n");                \
  76.     }                            \
  77.     fprintf (FILE, "\t.version\t\"%s %s\"\n",        \
  78.          language_string, version_string);        \
  79.     if (optimize) ASM_FILE_START_1 (FILE);        \
  80.   } while (0)
  81.  
  82. #define ASM_FILE_START_1(FILE) fprintf (FILE, "\t.optim\n")
  83.  
  84. /* This is how to output an assembler line
  85.    that says to advance the location counter
  86.    to a multiple of 2**LOG bytes.  */
  87.  
  88. #define ASM_OUTPUT_ALIGN(FILE,LOG)    \
  89.     if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
  90.  
  91. /* This is how to output an assembler line
  92.    that says to advance the location counter by SIZE bytes.  */
  93.  
  94. #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
  95.   fprintf ((FILE), "\t.set\t.,.+%u\n", (SIZE))
  96.  
  97. /* Output before read-only data.  */
  98.  
  99. #undef TEXT_SECTION_ASM_OP
  100. #define TEXT_SECTION_ASM_OP ".text"
  101.  
  102. /* Output before writable data.  */
  103.  
  104. #undef DATA_SECTION_ASM_OP
  105. #define DATA_SECTION_ASM_OP ".data"
  106.  
  107. /* Define the syntax of labels and symbol definitions/declarations.  */
  108.  
  109. /* This says how to output an assembler line
  110.    to define a global common symbol.  */
  111.  
  112. #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)  \
  113. ( fputs (".comm ", (FILE)),            \
  114.   assemble_name ((FILE), (NAME)),        \
  115.   fprintf ((FILE), ",%u\n", (ROUNDED)))
  116.  
  117. /* This says how to output an assembler line
  118.    to define a local common symbol.  */
  119.  
  120. #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)  \
  121. ( fputs (".lcomm ", (FILE)),            \
  122.   assemble_name ((FILE), (NAME)),        \
  123.   fprintf ((FILE), ",%u\n", (ROUNDED)))
  124.  
  125. /* This is how to store into the string BUF
  126.    the symbol_ref name of an internal numbered label where
  127.    PREFIX is the class of label and NUM is the number within the class.
  128.    This is suitable for output with `assemble_name'.  */
  129.  
  130. #define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER)    \
  131.   sprintf ((BUF), "*.%s%d", (PREFIX), (NUMBER))
  132.  
  133. /* This is how to output a reference to a user-level label named NAME.  */
  134.  
  135. #define ASM_OUTPUT_LABELREF(FILE,NAME)    \
  136.   fprintf (FILE, "%s", NAME)
  137.  
  138. /* This is how to output an internal numbered label where
  139.    PREFIX is the class of label and NUM is the number within the class.  */
  140.  
  141. #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)    \
  142.   fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
  143.